package com.ruoyi.project.system.house.img.service.impl;

import javax.annotation.Resource;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.uniquekey.IdGererateFactory;
import com.ruoyi.project.system.house.img.mapper.HouseImgMapper;
import com.ruoyi.project.system.house.img.domain.HouseImg;
import com.ruoyi.project.system.house.img.service.IHouseImgService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 房源图片Service业务层处理
 * 
 * @author f_baisi
 * @date 2020-08-27
 */
@Service
public class HouseImgServiceImpl implements IHouseImgService 
{
    @Resource
    private IdGererateFactory idGererateFactory;
    @Autowired
    private HouseImgMapper houseImgMapper;

    /**
     * 查询房源图片
     * 
     * @param id 房源图片ID
     * @return 房源图片
     */
    @Override
    public HouseImg selectHouseImgById(String id)
    {
        return houseImgMapper.selectHouseImgById(id);
    }

    /**
     * 查询房源图片列表
     * 
     * @param houseImg 房源图片
     * @return 房源图片
     */
    @Override
    public List<HouseImg> selectHouseImgList(HouseImg houseImg)
    {
        return houseImgMapper.selectHouseImgList(houseImg);
    }

    /**
     * 新增房源图片
     * 
     * @param houseImg 房源图片
     * @return 结果
     */
    @Override
    public int insertHouseImg(HouseImg houseImg)
    {
        houseImg.setId(this.idGererateFactory.nextStringId());
        return houseImgMapper.insertHouseImg(houseImg);
    }

    /**
     * 修改房源图片
     * 
     * @param houseImg 房源图片
     * @return 结果
     */
    @Override
    public int updateHouseImg(HouseImg houseImg)
    {
        return houseImgMapper.updateHouseImg(houseImg);
    }

    /**
     * 删除房源图片对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHouseImgByIds(String ids)
    {
        return houseImgMapper.deleteHouseImgByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除房源图片信息
     * 
     * @param id 房源图片ID
     * @return 结果
     */
    @Override
    public int deleteHouseImgById(String id)
    {
        return houseImgMapper.deleteHouseImgById(id);
    }

    @Override
    public int deleteByHid(String id) {
        return this.houseImgMapper.deleteByHid(id);
    }
}
